'use strict';

const db = uniCloud.database();
exports.main = async (event, context) => {

	const {
		id='6572a3527ad52d3447c97603',
		cover = 'https://img.bosszhipin.com/boss/avatar/avatar_16.png',
		sex = '男',
		age = '18',
		edu ='本科',
		school ='泉州师范学院'
	} = event

	console.log("id"+ id)
	let user = await db.collection('uni-id-users')
		.doc(id)
		.update({
			'cover': db.command.set(
				cover
			),
			'sex': db.command.set(
				sex
			),
			'age': db.command.set(
				age
			),
			'edu': db.command.set(
				edu
			),
			'school': db.command.set(
				school
			)
		});

	return {
		code: 200,
		msg: '数据请求成功',
		data: user
	}
}